package com.ross.mode.two;

/**
 * @version 1.0.0
 * @className: Tank
 * @description: 通过组合实现静态代理
 * @author: zhangjunfa
 * @date: 2023/3/30 17:22
 */
public class Tank implements Movable {
    public void move() {
        System.out.println("我在跑步，我跑了1KM。。。");
    }

    public static void main(String[] args) {
        Tank tank = new Tank();
        new LogProxy(tank).move();
    }
}

class LogProxy implements Movable {
    private Movable movable;

    public LogProxy(Movable movable) {
        this.movable = movable;
    }

    public void move() {
        System.out.println("我在跑步前做的准备，。");
        movable.move();
        System.out.println("跑步结束后做的准备，。");
    }
}
